#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1005;

int n, d;
int x[N], y[N];
struct Seg {
  double l, r;
  bool operator<(const Seg& o) const { return l < o.l; }
} a[N];
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> d;
  rep(i, 1, n) {
    int x, y;
    cin >> x >> y;
    if (y > d) {
      cout << -1;
      return 0;
    }
    double z = sqrt(d * d - y * y);
    a[i].l = x - z, a[i].r = x + z;
  }
  sort(a + 1, a + n + 1);
  double l = -1e9, r = -1e9;
  int ans = 0;
  rep(i, 1, n) {
    // cout << i << ' ' << a[i].l << ' ' << a[i].r << endl;
    if (r < a[i].l)
      ans++, l = a[i].l, r = a[i].r;
    else
      l = max(l, a[i].l), r = min(r, a[i].r);
    // cout << ans << ' ' << l << ' ' << r << endl;
  }
  cout << ans;
  return 0;
}